<template>
	<view class="userPopupShow" v-if="userPopupShow">
		<view class="userPopupShow-mask" @click="closeUserPopup"></view>
		<view class="userPopupShow-c">
			<view class="userPopupShow-close" @click="closeUserPopup">
				<u-icon name="close" color="#909399" size="20"></u-icon>
			</view>
			<view class="userPopupShow-c-title">(上传微信二维码)</view>
			<view class="userPopupShow-c-add" @click="uploadQrCode()" v-if="!WeChat_QR_code">
				<image :src="ossUrl + `/static/5.png`" mode="aspectFill"></image>
			</view>
			<view class="userPopupShow-c-del" @click="uploadQrCode()" v-else>
				<image :src="WeChat_QR_code" mode="aspectFill" class="img"></image>
				<view class="userPopupShow-c-del-item" @click="del">
					<image :src="ossUrl + `/static/15.png`" mode=""></image>
				</view>
			</view>
			<view class="userPopupShow-c-tx">注明：在微信底部菜单单点（我），您的头像后面有一个二维码图标，点击后，选择底部的保存图片。然后在这里上传二维码即可。</view>
			<view class="form-btn" @click="submit">确定</view>
		</view>
	</view>
</template>

<script>
	import {
		uploadImg
	} from '@/common/upload.js'
	import {
		InformationLianchuangList
	} from '@/common/http/api.js'
	export default {
		data(){
			return {
				userPopupShow: false,
				WeChat_QR_code: ''
			}
		},
		methods:{
			show(WeChat_QR_code){
				this.WeChat_QR_code = WeChat_QR_code
				this.userPopupShow = true
			},
			uploadQrCode() {
				uploadImg().then(res => {
					console.log('上传', res)
					this.WeChat_QR_code = res.data.url
				})
			},
			del(){
				this.WeChat_QR_code = ''
			},
			submit() {
				this.$emit('submit', this.WeChat_QR_code)
				this.closeUserPopup()
			},
			closeUserPopup() {
				this.userPopupShow = false
			}
		}
	}
</script>

<style lang="scss" scoped>
	.userPopupShow {
		width: 100vw;
		height: 100vh;
		position: fixed;
		top: 0;
		right: 0;
		z-index: 999999;
		.userPopupShow-mask {
			width: 100%;
			height: 100%;
			background: rgba(0,0,0,0.2);
		}
		.userPopupShow-c {
			width: 600rpx;
			height: fit-content;
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
			margin: auto;
			z-index: 2;
			background: white;
			border-radius: 30rpx;
			box-shadow: 0 0 12rpx #e4e4e4;
			padding-bottom: 30rpx;
			.userPopupShow-close {
				display: flex;
				justify-content: flex-end;
				box-sizing: border-box;
				width: 20rpx;
				height: 20rpx;
				position: absolute;
				right: 20rpx;
				top: 20rpx;
			}
			
		}
		
	}
	.userPopupShow-c-title {
		font-size: 30rpx;
		text-align: center;
		width: 100%;
		color: #999999;
		padding: 10rpx 0;
		margin-bottom: 30rpx;
	}
	.userPopupShow-c-add {
		width: 151rpx;
		height: 151rpx;
		border-radius: 20rpx;
		border: 1px solid #999999;
		display: flex;
		align-items: center;
		justify-content: center;
		margin: 0 auto;
		margin-bottom: 30rpx;
		image {
			width: 48rpx;
			height: 49rpx;
		}
	}
	
	.userPopupShow-c-del {
		width: 151rpx;
		height: 151rpx;
		border-radius: 20rpx;
		border: 1px solid #999999;
		display: flex;
		align-items: center;
		justify-content: center;
		margin: 0 auto;
		position: relative;
		margin-bottom: 30rpx;
		.userPopupShow-c-del-item {
			width: 50rpx;
			height: 50rpx;
			position: absolute;
			top: -23rpx;
			right: -18rpx;
			z-index: 2;
			display: flex;
			align-items: center;
			justify-content: center;
			image {
				width: 38rpx;
				height: 38rpx;
			}
		}
		.img {
			width: 100%;
			height: 100%;
			border-radius: 20rpx;
		}
		
	}
	.userPopupShow-c-tx {
		width: 80%;
		margin: 0 auto;
		box-sizing: border-box;
		padding: 10rpx 0;
		font-size: 26rpx;
		color: #999999;
	}
	.form-btn {
	
		width: 80%;
		height: 80rpx;
		background: #23B97F;
		border-radius: 80rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 28rpx;
		color: white;
		margin: 0 auto;
		margin-top: 30rpx;
	}
	
	
</style>